import request from '@/utils/request'

/**
 * 获取我的待采样表格
 * @param {Number} Rows
 * @param {Number} Page
 * @param {Array} Search :0=物料编码
 */
export function toBeSampledTable(params) {
  return request({
    url: '/API/QualityTest/GetSampleDataPage',
    method: 'get',
    params,
    successMsg: false, //请求成功通知，支持String & Boolean
    failMsg: false //请求失败通知，支持String & Boolean
  })
}

/**
 * 获取检验项目
 * @param {String} Code 物料编码
 */
export function checkItems(params) {
  return request({
    url: '/API/QualityTest/GetAttributesByMaterialCode',
    method: 'get',
    params,
  })
}

/**
 * 获取单位字典
 * @param {Array} Search[0] :类型=单位
 */
export function unitsTree() {
  return request({
    url: '/API/BaseData/GetDictionaryTree',
    method: 'get',
    params: {
      pageModel: {
        Search: ['UnitCode']
      }
    }
  })
}

/**
 * 保存采样
 * @param {*} data 表单参数
 */
export function saveSampled(data) {
  return request({
    url: '/API/QualityTest/SaveSampleData',
    method: 'post',
    data,
    successMsg: true,
    failMsg: true
  })
}

/**
 * 使用申请
 * @param {*} data 表单参数
 */
export function reservedSampleUser(data) {
  return request({
    url: '/API/RetainedSample/ReservedSampleUser',
    method: 'post',
    data,
    successMsg: true,
    failMsg: true
  })
}

/**
 * 查询审批记录
 * @param {String} Code 物料编码
 */
export function GetUserDisposeApply(params) {
  return request({
    url: '/API/RetainedSample/GetUserDisposeApply',
    method: 'get',
    params,
  })
}

/**
 * 是否通过使用申请
 * @param {*} data 
 */
export function IsPassReservedSampleUser(data) {
  return request({
    url: '/API/RetainedSample/IsPassReservedSampleUser',
    method: 'post',
    data,
    successMsg: true,
    failMsg: true
  })
}
/**
 * 是否通过销毁申请
 * @param {*} data 
 */
export function IsPassReservedSampleDispose(data) {
  return request({
    url: '/API/RetainedSample/IsPassReservedSampleDispose',
    method: 'post',
    data,
    successMsg: true,
    failMsg: true
  })
}

/**
 * 查询留样管理记录
 * @param {String} Code 物料编码
 */
export function GetUserDispose(params) {
  return request({
    url: '/API/RetainedSample/GetUserDispose',
    method: 'get',
    params,
  })
}

/**
 * 批号获取
 * @param {String} Code 物料编码
 */
export function GetReservedSampleSelect(params) {
  return request({
    url: '/API/RetainedSample/GetReservedSampleSelect',
    method: 'get',
    params,
  })
}

/**
 * 查询留样观察记录
 * @param {String} Code 物料编码
 */
export function GetSampleObserve(params) {
  return request({
    url: '/API/RetainedSample/GetSampleObserve',
    method: 'get',
    params,
  })
}

/**
 * 删除观察信息
 * @param {*} data 
 */
export function DeleteSampleObserve(data) {
  return request({
    url: '/API/RetainedSample/DeleteSampleObserve',
    method: 'post',
    data,
    successMsg: true,
    failMsg: true
  })
}


/**
 * 观察修改获取数据
 * @param {String} Code 物料编码
 */
export function GetSampleObserveById(params) {
  return request({
    url: '/API/RetainedSample/GetSampleObserveById',
    method: 'get',
    params,
  })
}

/**
 * 修改观察信息
 * @param {*} data 
 */
export function UpdateSampleObserve(data) {
  return request({
    url: '/API/RetainedSample/UpdateSampleObserve',
    method: 'post',
    data,
    successMsg: true,
    failMsg: true
  })
}

/**
 * 查询留样环境记录
 * @param {String} Code 物料编码
 */
export function GetSampleEnvironment(params) {
  return request({
    url: '/API/RetainedSample/GetSampleEnvironment',
    method: 'get',
    params,
  })
}

/**
 * 查询留样环境chart图数据
 * @param {String} Code 物料编码
 */
export function GetSampleEnvironmentMap(params) {
  return request({
    url: '/API/RetainedSample/GetSampleEnvironmentMap',
    method: 'get',
    params,
  })
}

/**
 * 修改环境信息
 * @param {*} data 
 */
export function UpdateSampleEnvironment(data) {
  return request({
    url: '/API/RetainedSample/UpdateSampleEnvironment',
    method: 'post',
    data,
    successMsg: true,
    failMsg: true
  })
}

/**
 * 修改环境信息
 * @param {*} data 
 */
export function AddSampleEnvironment(data) {
  return request({
    url: '/API/RetainedSample/AddSampleEnvironment',
    method: 'post',
    data,
    successMsg: true,
    failMsg: true
  })
}




